package com.packet.cheng;
/**
 @author zaicheng
 @version 1.0
 @date 2022-04-19
 @email zzc15847256473@163.com
 */

import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;

import java.util.Date;
import java.util.concurrent.*;

public class Test_Time {

    public static void main(String[] args) throws ExecutionException, InterruptedException {

        DateTime offsetDay = DateUtil.offsetDay(new Date(), 3);
        DateTime lastWeek = DateUtil.lastWeek();
        System.out.println(offsetDay);
        System.out.println(lastWeek);


        ExecutorService service = Executors.newFixedThreadPool(5);
        for (int i=0;i<10;i++) {
            Future<Integer> submit = service.submit(new Callable<Integer>() {

                int k = 0;

                /**
                 * Computes a result, or throws an exception if unable to do so.
                 *
                 * @return computed result
                 * @throws Exception if unable to compute a result
                 */
                @Override
                public Integer call() throws Exception {
                    System.out.println(Thread.currentThread().getName()+"线程对k:"+k+",进行++操作");
                    k++;
                    System.out.println("result："+k);
                    return k;
                }
            });
            Integer integer = submit.get();
            System.out.println(integer);
        }
    }
}
